/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package model;

import javax.ejb.Stateless;
import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;
import javax.persistence.Query;

/**
 *
 * @author Administrator
 */
@Stateless
public class AccountFacade extends AbstractFacade<Account> {
    @PersistenceContext(unitName = "RecruitmentProcessSystemPU")
    private EntityManager em;

    @Override
    protected EntityManager getEntityManager() {
        return em;
    }

    public AccountFacade() {
        super(Account.class);
    }
    
    public Account Login(String username, String password) {
        Query q = this.em.createQuery("select ac from Account ac where ac.userName=:username and ac.password=:password");
        q.setParameter("username", username);
        q.setParameter("password", password);
        return (Account) q.getSingleResult();
    }
}
